package com.common.exception;

import com.common.consts.CommonRespCode;

/**
 * @author: zhaojd1604@gmail.com
 * @date: 2019-01-02 16:45
 * @description: 通用业务逻辑异常
 * @since: V0.0.1
 */
public abstract class CommonException extends RuntimeException {

    private static final long serialVersionUID = -2482203680602825346L;

    public CommonException() {
        super();
    }

    public CommonException(String msg) {
        super(msg);
    }

    public CommonException(Exception e) {
        super(e);
    }

    public CommonException(String msgTemplete, Object[] objs) {
        super(String.format(msgTemplete, objs));
    }

    public CommonException(String msg, Exception e) {
        super(msg, e);
    }

    /**
     * 子类覆盖此方法返回不同的业务异常代码
     */
    public int getResponseCode() {
        return CommonRespCode.BUSINESS_EXCEPTION.getCode();
    }
}